const { defineConfig } = require('@vue/cli-service')
const Mock = require('mockjs')

const data = Mock.mock({
  "list|8":[{
    title:'@ctitle(2)',
    'children|6':[{
      img:"@image(50x50,@color)",
      name:"@ctitle(4)",
      word:"@cword",
      'price|10-100.1':10.1,
      num:0
    }]
  }]
})


module.exports = defineConfig({
  transpileDependencies: true,
  lintOnSave:false,
  devServer: {
    onAfterSetupMiddleware: function ({app}) {
      const bodyParser = require('body-parser')
      app.use(bodyParser.json())

      app.get('/list',(req,res)=>{
        res.send(data.list)
      })

    },
  },
})
